import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Icon } from 'antd-mobile';
import styled from 'styled-components';

const Item = styled.li`
    position: relative;
    padding-left:70px;
    line-height: 20px;
    
    &:last-child {
        .info {
            border-bottom: none;
        }
    }
    img {
        width: 40px;
        height: 40px;
        border-radius: 20px;
        position: absolute;
        left: 10px;
        top: 10px;      
    }
    p {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .info {
        border-bottom: 1px solid #ddd;
        padding: 10px 50px 10px 0;
    }
    .time {
        position: absolute;
        right: 10px;
        top: 20px;
        color: #aaa;
        font-size: 12px;
    }
    .name {
        font-size: 14px;
        color: #000;
        padding-right: 50px;
        padding-top: 5px;
    }
    .desc {
        font-size: 12px;
        color: #aaa;
        height: 16px;
        line-height: 16px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .action {
        position: absolute;
        right: 10px;
        padding: 10px;
        top: 10px;
    }
`

export default function UserItem(props) {
    return (
        <Item>
            <img src='http://www.qqzhi.com/uploadpic/2015-01-22/073441407.jpg'/>
            <div className='info'>
                <p className='name'>{props.name}</p>
                <p className='desc'>{props.desc}</p>
            </div> 
            <div className='action'>
                <Icon type='plus' onClick={props.onClick}/>    
            </div>
                  
        </Item>
    ) 
}